// pages/home-video/index.js
const db = wx.cloud.database()
Page({
  data: {
    topMVs:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getMVInfo()
  },
  onShow: function () {
    this.getMVInfo()
  },
  getMVInfo(){
    var that = this
    db.collection('topMVs').get({
      success: function(res) {
        that.setData({
          topMVs:res.data
        })
      }
    })
  },
  handleVideoItemClick(event){
    //根据event获取id
    const id = event.currentTarget.dataset.item.id
    console.log(id)
    //页面跳转
    wx.navigateTo({
      url: `/pages/detail-video/index?id=${id}`,
    })
  }
})